package main

import "strings"

func simplifyPath(path string) string {
	parts := strings.Split(path, "/")
	var result []string
	for _, part := range parts {
		if part == "." || part == "" {
			continue
		} else if part == ".." {
			if len(result) > 0 {
				result = result[:len(result)-1]
			}
		} else {
			result = append(result, part)
		}
	}
	return "/" + strings.Join(result, "/")
}

func main() {
	println(simplifyPath("/home//foo/"))
}